GenLabs Platform: Agent Configuration and Usage Guide

This guide provides a comprehensive overview of configuring and using AI agents on the GenLabs platform.

Agent Details Page

This page, accessed by clicking a agent's name on the dashboard, allows fine-tuning of its behavior.

Editing Agent Settings

Available Models

NEW! FREE Access to decentralized models when you sign up for a new account1.

The following table lists the available models, their availability (Decentralized, Dedicated, or Both), and their price in credits for each plan. Prices are estimates and may vary.

Model Availability Decentralized Price Input Price Output Price
gpt-4 Both 20000 30000 60000
gpt-4-turbo Both 10000 10000 30000
gpt-4o Both 1000 2500 10000
gpt-4o-mini Both 50 150 600
gemini-pro Both 100 75 300
gemini-1.0-pro Both 100 75 300
gemini-1.5-pro-latest Both 1000 1250 5000
gemini-1.5-flash-latest Both 50 75 300
gemini-2.0-flash Both 0 100 400
gemini-2.0-flash-thinking-exp Both 0 100 100
gemini-2.0-pro-exp Both 0 100 100
gemini-2.0-flash-lite-preview Both 0 100 100
gemini-exp-1206 Both 0 100 100
learnlm-1.5-pro-experimental Both 0 100 100
gemini-flash-1.5-8b Both 0 100 100
gemma-2-9b-it Both 0 100 100
llama-3.1-8b-instruct Both 10 30 60
llama-3.2-11b-vision-instruct Both 40 55 55
llama-3-405b Both 100 200 200
dolphin3.0-r1-mistral-24b Both 0 100 100
dolphin3.0-mistral-24b Both 0 100 100
qwen-vl-plus Both 0 100 100
qwen2.5-vl-72b-instruct Both 0 100 100
mistral-small-24b-instruct-2501 Both 0 70 140
deepseek-r1-distill-llama-70b Both 0 230 690
deepseek-r1 Both 0 80 240
rogue-rose-103b-v0.2 Both 0 100 100
deepseek-v3 Both 0 90 90
llama-3.3-70b-instruct Both 0 120 30
llama-3.1-nemotron-70b-instruct Both 0 120 30
mistral-nemo Both 0 35 8
mistral-7b-instruct Both 0 100 100
phi-3-mini-128k-instruct Both 0 100 100
phi-3-medium-128k-instruct Both 0 100 100
llama-3-8b-instruct Both 0 100 100
openchat-7b Both 0 100 100
toppy-m-7b Both 0 100 100
zephyr-7b-beta Both 0 100 100
mythomax-l2-13b Both 0 100 100
1Offer valid for limited time only, and subject to availability. Offer not valid for existing accounts. T&C's apply.

Rate Limits

The following table outlines the rate limits for different tiers:

Tier Requests per Minute Requests per Day Credit Range
Tier 1 10 500 10,000 credits or less
Tier 2 60 5000 10,000 - 50,000 credits
Tier 3 60 10000 50,000 - 100,000 credits
Tier 4 120 50000 100,000 - 500,000 credits
Tier 5 240 100000 500,000+ credits

Note that if you fall under any tier limit, you will lose access to the higher tier rate limits. For example, if you are in Tier 2, and you credits fall below 10000, you will be downgraded to Tier 1. To continue using the higher rate limits , buy more credits.

Prompt/Response data for models on tier 1 may be used to improve respective owner's services

How pricing is caluclated:

Agent Usage

Playground

The Playground allows you to interactively test your agent.

  1. Endpoint URL: The URL for making API requests to your agent.
  2. Conversation Builder:
    • Add "user" and "assistant" messages to simulate a conversation.
    • Edit the content within each message to craft specific prompts and responses.
    • If you haven't set a default system message, you can set one here
  3. Headers: You'll need to paste the API key into the Authorization header. Ensure your API key is correct.
  4. Run: Sends the constructed conversation to your agent for processing.
  5. Show Code: Generates code snippets in various programming languages (Python, JavaScript, cURL, etc.) demonstrating how to make API calls to your agent with the current conversation. This simplifies integration into your applications.
  6. Playground Output: Displays the raw JSON response from your agent.

Attaching Tools

Tools extend the capabilities of your agents by allowing them to interact with external services and data. Examples of tools might include:

The "Attach Tools" section lets you manage which tools are available to your agent. You can create these tools here.

When you receive a tool call, you can make an API request to another application, or make a request to your database.

For best results, use this format on the next request (after the tool call):

User: Can you tell me when my order arrives?

Assistant: Called tool: Get delivery date. Got: 2/3/2024

Aditionally, if you want to generate a response in a user-friendly manner, you can add:

User: Generate a final response in a user friendly manner.

Assistant: Your order will arrive on February 2nd, 2024.

Then on the next call, truncate the process into one step:

User: Can you tell me when my order arrives?

Assistant: Called tool: Get delivery date. Got: 2/3/2024 Your order will arrive on February 2nd, 2024.

OR:

User: Can you tell me when my order arrives?

Assistant: Called tool: Get delivery date. Got: 2/3/2024 Your order will arrive on February 2nd, 2024.

Managing Trust Keys and Agreements

The GenLabs Platform uses API keys for authentication and requires acceptance of trust agreements for certain features. This section explains how to manage your API keys and view your agreements.

API Keys (Trust Keys)

API keys are used to authenticate requests to your agents. You can manage your API keys on the Trust Keys page

Viewing Your Keys:

The Keys page displays a table of your existing API keys, including their name, creation date, last used date, and the actual key value (only shown once before first use).

Creating a New Key:

  1. Click the button.
  2. Enter a descriptive name for your key in the modal.
  3. Click . Important: Copy the generated API key immediately. You won't be able to view it again after the modal closes.

Deleting a Key:

Click the button next to the key you want to remove. This action is irreversible.

Key Security:

Trust Agreements

Certain features, such as decentralized agent deployment, require you to accept trust agreements. You can view your accepted agreements on the Trust/Agreements page.

Viewing Agreements:

The Agreements page displays a table of your accepted agreements, including their name and the date you accepted them. Clicking "View" next to an agreement will show the full text of the agreement.

Accepting Agreements:

Agreements are typically presented and accepted during specific actions, such as creating a decentralized model. You'll be prompted to read and accept the agreement before proceeding. Once accepted, the agreement will appear on the Agreements page.

Types of Agreements:

Logs Page

The Logs page provides a detailed view of your agent's usage history. You can access this page by clicking the "View Detailed Statistics" button on the Agent Details page.

Features

Log Details Modal

When you click the button for a log entry, a modal will appear with the following information:

Log Data

The logs table displays the following information for each log entry:

Session Maps Beta

The Logs page also includes a session map, which displays the agent's activity over time. This map provides a visual representation of the agents conversation




GenLabs Query Agent Documentation

Table of Contents

Introduction

GenLabs Agents provide a powerful interface for AI-driven conversations with built-in support for tool execution and document analysis. The platform offers two distinct API approaches: Transactional and Threaded, each optimized for different use cases.

Authentication

Every request requires an API key in the headers:

headers: {
      'Authorization': 'your-api-key-here'
    }
    

Note: There is no "Bearer" prefix in the header.

API Versions

Version 1 (Transactional)

Version 2 (Threaded) BETA

Logging must be turned on for your agent to use this API.

Transactional API

Basic Message Structure

{
      "conversation": [
        {
          "role": "system",
          "content": "You are a helpful assistant specialized in customer service."
        },
        {
          "role": "user",
          "content": "I need help with my recent order."
        },
        {
          "role": "assistant",
          "content": "I'll be happy to help. Could you provide your order number?"
        },
        {
          "role": "user",
          "content": "Yes, it's ORDER-123456"
        }
      ]
    }
    

Context Management

The Transactional API gives you complete control over conversation context. Best practices include:

  1. System Messages: Set the agent's behavior and capabilities

    {
          "role": "system",
          "content": "You are a technical support specialist with expertise in cloud computing."
        }
        
  2. Relevant History: Include previous messages that provide context

    { "role": "user", "content": "My EC2 instance keeps crashing" }, { "role": "assistant", "content": "What's the instance type and OS?" }, { "role": "user", "content": "t2.micro running Ubuntu 20.04" }
  3. State Management: Track important details in conversation

    { "role": "assistant", "content": "Based on your t2.micro instance running Ubuntu 20.04, let's check the system logs." }

Threaded API

The threaded API is similar to OpenAI's "Assistants" API. It maintains conversation state and requires only the latest message. This is ideal for long-running conversations.

Single Message Format

      
      {
        "message": {
          "role": "user",
          "content": "Check the status of my order"
        }
      }
      
    

Session Management

Include a unique session ID (for each conversation) in headers for consistent threading:

      
      headers: {
        'Authorization': 'your-api-key-here',
        'session': 'unique-session-id'
      }
      
    

Conversation Flow Examples

  1. Initial Query:

          
          {
            "message": {
              "role": "user",
              "content": "I need to check my order status"
            }
          }
          
        
  2. Follow-up:

          
          {
            "message": {
              "role": "user",
              "content": "The order number is ORD-789"
            }
          }
          
        

Tool Integration

Available Tool Types

  1. File Search Tools
  2. Custom Function Tools

Tool Call Examples

  1. Order Lookup:

          
          {
            "message": {
              "role": "user",
              "content": "Get the details for order #12345"
            }
          }
          
        

    Response:

          
            {
              "status": "success",
              "message": "Tool call(s) initiated",
              "tool_calls": [
                {
                    "name": "tool_name",
                    "parameters": {{
                        "param1": "value1"
                        "param2": "value2"
                    }}
                }
              ]
            }
            // Or, in the case of a question...
    
            {
              "status": "success",
              "message": "Tool call(s) initiated",
              "tool_calls": [
                    {
                        "name": "tool_name",
                        "question": "Could you please tell me your order number?"
                    }
                ]
            }
          
        
  2. Customer Update:

              
                  {
                    "message": {
              "role": "user",
              "content": "Update shipping address for customer ID 789 to 123 Main St, Boston, MA"
                    }
                  }
                  
            

Parameter Handling

The agent intelligently handles missing parameters:

      
        {
          "status": "success",
          "message": "Tool call(s) initiated",
          "tool_calls": [
                {
                    "name": "tool_name",
                    "question": "Sure! Could you please enter your phone number?"
                }
            ]
        }
      
    

File Search Capabilities

Supported File Types

Search Implementation

  1. Basic Document Query:

              
                  {
                    "message": {
              "role": "user",
              "content": "Find information about refunds in the terms of service"
                    }
                  }
                  
            
  2. Specific Section Search:

              
                  {
                    "message": {
              "role": "user",
              "content": "What does section 3.2 of the contract say about liability*?"
                    }
                  }
                  
            
  3. Multi-Document Analysis:

              
                  {
                    "message": {
              "role": "user",
              "content": "Compare the payment terms between the old and new contracts"
                    }
                  }
                  
            

File Search Response Format

      
      {
        "status": "success",
        "data": {
          "file_searches": ["Contract_Search", "Terms_Search"],
          "response": "Based on the documents, the payment terms have changed in the following ways..."
        }
      }
      
    
*Generative AI shouldn't be used for legal or financial advice. This is for demonstration purposes only.

Advanced Features

Tool Chaining

Combine multiple tools in sequence:

        
            {
        "message": {
          "role": "user",
          "content": "Find all orders from customer 123 and update their status to shipped"
        }
            }
            
      

Context Awareness

You can feed the responses back into the agent (currently v1 API only) to maintain context:

        
{
  "message": {
    "role": "user",
    "content": "What was the total value of those orders?"
  }
}
            
      

Use Cases & Examples

Customer Service Portal

  1. Order Management:

              
    {
      "conversation": [
        {
          "role": "system",
          "content": "You are a customer service agent for a retail company. You are chatting with John Doe (email: [email protected])"
        },
        {
          "role": "user",
          "content": "Find all pending orders for me"
        }
      ]
    }
                  
            
    You could add a tool called "Get Order Details" that would return the order details for the given email.
  2. Issue Resolution:

              
    {
      "message": {
        "role": "user",
        "content": "Create a return request for order #12345 with reason 'defective product'"
      }
    }
                  
            
  3. You could make a tool called "Create Return request" that would create a return request for the given order number and reason.

Data Operations

  1. Inventory Management:

              
                  {
                    "message": {
              "role": "user",
              "content": "Check stock levels for SKU-789 across all warehouses"
                    }
                  }
                  
            
  2. You could create a tool called "Check Inventory" that would return the stock levels for the given SKU across all warehouses.
  3. Report Generation:

              
                  {
                    "message": {
              "role": "user",
              "content": "Generate a summary of all transactions from March 2024"
                    }
                  }
                  
            
  4. You could create a file search tool to search for all transactions from a certain date range.

Best Practices

1. Conversation Management

2. Tool Usage

3. File Searches

4. Error Handling

Troubleshooting

Common Issues

  1. Authentication Errors

    • Verify API key is valid
    • Check key permissions
    • Ensure proper header format
  2. Tool Execution Failures

    • Verify parameter completeness
    • Check tool availability
    • Review error messages
  3. File Search Issues

    • Confirm file accessibility
    • Verify file format support
    • Check search query specificity

Performance Optimization

  1. Response Time

    • Use streaming for long operations
    • Optimize conversation history length
    • Implement proper caching
  2. Resource Usage

    • Monitor credit consumption
    • Track tool usage patterns
    • Optimize file search queries

Agent API Documentation

Important: The following endpoints require a "Secret" API key.

POST /create_agent

Creates a new agent associated with a user.

Request

Method: POST

URL: /create_agent

Headers:

Body:

{
      "session_id": "string",  // Optional: User's session ID for authentication
      "api_key": "string",     // Optional: User's API key for authentication
      "agent_name": "string",  // Required: Name of the agent to be created
      "plan": "string",        // Required: Plan for the agent ('Decentralized' or 'Dedicated')
      "region": "string"       // Required if plan is 'Dedicated': Region for the agent (e.g., 'us-east-1', 'us-west-1', 'eu-west-1')
    }
    

Authentication:

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters:

Response

Success Response (201 Created):

{
      "message": "Agent created successfully"
    }
    

Error Responses:

Request

Using API Key:

{
      "api_key": "any_one_of_your_keys",
      "agent_name": "My New Agent",
      "plan": "Dedicated",
      "region": "us-east-1"
    }
    

Notes



DELETE /delete_agent

Deletes an existing agent associated with a user.

Request

Method: DELETE

URL: /delete_agent

Headers:

Body:

{
      "session_id": "string",  // Optional: User's session ID for authentication
      "api_key": "string",     // Optional: User's API key for authentication
      "agent_id": "string"     // Required: ID of the agent to be deleted
    }
    

Authentication

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided or is invalid, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters

Response

Success Response (200 OK):

{
      "message": "Agent deleted successfully"
    }
    

Error Responses:

Example Request

Using Session ID:

{
      "session_id": "user-session-id",
      "model_id": "model-uuid"
    }
    

Using API Key:

{
      "api_key": "user-api-key",
      "model_id": "model-uuid"
    }
    

Notes



POST /get_agent_details

Retrieves detailed information about a specific model associated with a user.

Request

Method: POST

URL: /get_agent_details

Headers:

Body:

{
      "session_id": "string",  // Optional: User's session ID for authentication
      "api_key": "string",     // Optional: User's API key for authentication
      "modelId": "string"      // Required: ID of the model to retrieve details for
    }
    

Authentication

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided or is invalid, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters

Response

Success Response (200 OK):

{
      "modelName": "string",
      "creationDate": "YYYY-MM-DD HH:MM:SS",
      "modelScript": "string",
      "plan": "string",
      "region": "string",
      "apiKey": "string",
      "tools": "string",
      "topP": "float",
      "temperature": "float",
      "system": "string",
      "stream": "boolean"
    }
    

Error Responses:

Example Request

Using Session ID:

{
      "session_id": "user-session-id",
      "modelId": "model-uuid"
    }
    

Using API Key:

{
      "api_key": "user-api-key",
      "modelId": "model-uuid"
    }
    

Example Success Response

{
      "modelName": "My Awesome Model",
      "creationDate": "2023-10-01 12:00:00",
      "modelType": null, //Legacy Field
      "modelProvider": null, //Legacy Field
      "modelScript": "print('Hello World')",
      "plan": "Dedicated",
      "region": "us-east-1",
      "apiKey": "generated-api-key",
      "tools": "Tool1, Tool2",
      "topP": 0.9,
      "temperature": 0.75,
      "system": "System Configuration",
      "stream": true
    }
    

PUT /update_agent

Updates an existing model associated with a user.

Request

Method: PUT

URL: /update_agent

Headers:

Body:

{
      "session_id": "string",  // Optional: User's session ID for authentication
      "api_key": "string",     // Optional: User's API key for authentication
      "modelId": "string",      // Required: ID of the model to be updated
      "modelName": "string",    // Optional: New name for the model
      "modelScript": "string",  // Optional: New script for the model
      "region": "string",       // Optional: New region for the model
      "plan": "string",        // Optional: New plan for the model
      "tools": ["string"],      // Optional: New tools for the model
      "topP": "float",          // Optional: New top_p for the model
      "apiKey": "string",       // Optional: New api_key for the model
      "temperature": "float",   // Optional: New temperature for the model
      "system": "string",       // Optional: New system message for the model
      "stream": "boolean"      // Optional: New stream setting for the model
    }
    

Authentication

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters:

Response

Success Response (200 OK):

{
      "message": "Model updated successfully"
    }
    

Error Responses:

Example Request

Using API Key:

{
      "api_key": "user-api-key",
      "modelId": "model-uuid",
      "modelScript": "print('Updated Script')",
      "region": "us-west-1"
    }
    

POST /create_tool

Creates a new tool associated with a user.

Request

Method: POST

URL: /create_tool

Headers:

Body:

      
      {
        "session_id": "string",  # Optional: User's session ID for authentication
        "api_key": "string",     # Optional: User's API key for authentication
        "name": "string",        # Required: Name of the tool to be created
        "description": "string", # Required: Description of the tool
        "type": "string",        # Required: Type of the tool ('File Search' or 'Custom')
        "tool_schema": "object"  # Optional: JSON schema for the tool parameters
      }
      
    

Authentication:

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters:

Response

Success Response (201 Created):

      
      {
        "message": "Tool created successfully",
        "tool_id": "integer"
      }
      
    

Error Responses:

Example Request

Using API Key:

      
      {
        "api_key": "any_one_of_your_keys",
        "name": "My New Tool",
        "description": "A tool for doing things",
        "type": "Custom",
        "tool_schema": {
          "type": "object",
          "properties": {
            "param1": { "type": "string" },
            "param2": { "type": "integer" }
          },
          "required": ["param1"]
        }
      }
      
    

Notes



POST /get_tools

Retrieves a list of tools associated with a user.

Request

Method: POST

URL: /get_tools

Headers:

Body:

      
      {
        "session_id": "string",  // Optional: User's session ID for authentication
        "api_key": "string"     // Optional: User's API key for authentication
      }
      
    

Authentication

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters:

Response

Success Response (200 OK):

      
      {
        "tools": [
          {
            "id": "integer",
            "name": "string",
            "description": "string",
            "type": "string",
            "tool_schema": "object"
          }
        ]
      }
      
    

Error Responses:

Example Request

Using API Key:

      
      {
        "api_key": "any_one_of_your_keys"
      }
      
    

Notes



DELETE /delete_tool/<int:tool_id>

Deletes an existing tool associated with a user.

Request

Method: DELETE

URL: /delete_tool/<int:tool_id>

Headers:

Body:

      
      {
        "session_id": "string",  // Optional: User's session ID for authentication
        "api_key": "string"     // Optional: User's API key for authentication
      }
      
    

Authentication

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters:

Response

Success Response (200 OK):

      
      {
        "message": "Tool deleted successfully"
      }
      
    

Error Responses:

Example Request

Using API Key:

      
      {
        "api_key": "any_one_of_your_keys"
      }
      
    

Notes



PUT /update_tool

Updates an existing tool associated with a user.

Request

Method: PUT

URL: /update_tool

Headers:

Body:

      
      {
        "session_id": "string",  // Optional: User's session ID for authentication
        "api_key": "string",     // Optional: User's API key for authentication
        "toolId": "integer",      // Required: ID of the tool to be updated
        "toolName": "string",    // Optional: New name for the tool
        "toolDescription": "string",  // Optional: New description for the tool
        "type": "string",        // Optional: New type for the tool
        "parameters": [          // Optional: New parameters for the tool
          {
            "name": "string",
            "type": "string",
            "description": "string",
            "required": "boolean"
          }
        ],
        "file": "string",        // Optional: New file data for the tool (base64 encoded)
        "tool_schema": "object"  // Optional: New JSON schema for the tool
      }
      
    

Authentication

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters:

Response

Success Response (200 OK):

      
      {
        "message": "Tool updated successfully"
      }
      
    

Error Responses:

Example Request

Using API Key:

      
      {
        "api_key": "any_one_of_your_keys",
        "toolId": 123,
        "toolName": "Updated Tool Name",
        "toolDescription": "An updated description",
        "type": "Custom",
        "parameters": [
          {
            "name": "param1",
            "type": "string",
            "description": "Parameter 1",
            "required": true
          }
        ],
        "tool_schema": {
          "type": "object",
          "properties": {
            "param1": { "type": "string" }
          },
          "required": ["param1"]
        }
      }
      
    

Notes



POST /get_tool_details

Retrieves detailed information about a specific tool associated with a user.

Request

Method: POST

URL: /get_tool_details

Headers:

Body:

 
      
      {
        "session_id": "string",  // Optional: User's session ID for authentication
        "api_key": "string",     // Optional: User's API key for authentication
        "toolId": "integer"      // Required: ID of the tool to retrieve details for
      }
      
    

Authentication

This endpoint supports two methods of authentication:

  1. Session ID: If a session_id is provided, the server will validate it against the database.
  2. API Key: If a session_id is not provided, the server will attempt to authenticate using the provided api_key. The API key must be a valid key associated with a user

Request Body Parameters:

Response

Success Response (200 OK):

      
      {
        "name": "string",
        "description": "string",
        "type": "string",
        "file": "string",
        "tool_schema": "object",
        "parameters": [
          {
            "name": "string",
            "type": "string",
            "description": "string",
            "required": "boolean"
          }
        ]
      }
      
    

Error Responses:

Example Request

Using API Key:

      
      {
        "api_key": "any_one_of_your_keys",
        "toolId": 123
      }
      
    

Notes

Support Chart

This chart provides an overview of the available functionalities

You can opt-in to try alpha features

OpenAI Functionality Support

Description Decentralized Dedicated OpenAI
Text Generation Yes Yes Yes
Assistants Yes Yes Yes
Vision No Alpha Yes
Image Generation Alpha Alpha Yes

Missing a Feature?

Can’t find the feature you’re looking for? We’d love to add it for you! Share your idea, and we’ll try our best to get it done within 3 business days (usually sooner!)

your feedback means the world to us! If we implement your idea, you could earn FREE CREDITS!